package com.biz.primus.model.payment.enums;


import com.biz.primus.common.enums.EnumerableValue;
import com.biz.primus.common.enums.converter.BaseEnumValueConverter;

/**
 * 交易类型
 * （交易方式）
 */
public enum PaymentTradeType implements EnumerableValue {

    ALIPAY_MOBILE(10, "APP支付(支付宝)", "mobile.securitypay.pay"),

    ALIPAY_PC(11, "PC支付(支付宝)", "create_direct_pay_by_user"),

    ALIPAY_WAP(12, "H5支付(支付宝)", "alipay.wap.create.direct.pay.by.user"),

    WECHAT_APP(20, "APP支付(微信)", "APP"),

    WECHAT_NATIVE(21, "扫码支付(微信)", "NATIVE"),

    WECHAT_WAP(22, "H5支付(微信)", "MWEB"),

    WECHAT_JSAPI(23, "公众号支付(微信)", "JSAPI"),

    BALANCE(30, "余额支付(电子钱包)", "BALANCE"),

    W02(41, "微信JS支付", "W02"),

    A02(42, "支付宝JS支付", "A02"),;

    public static PaymentTradeType valueOf(Integer type) {
        for (PaymentTradeType paymentType : values()) {
            if (paymentType.getValue() == type) {
                return paymentType;
            }
        }
        return null;
    }

    public static class Converter extends BaseEnumValueConverter<PaymentTradeType> {
    }

    private final int value;

    private final String tradeType;

    private final String desc;

    @Override
    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * {@linkplain PaymentTradeType#tradeType}
     */
    public String getTradeType() {
        return tradeType;
    }

    PaymentTradeType(int value, String desc, String tradeType) {
        this.value = value;
        this.desc = desc;
        this.tradeType = tradeType;
    }


}
